package test;

import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

public class TIJ674_EvenGenerator extends TIJ674_IntGenerator{
	private int currentEvenValue = 0;
	Lock lock = new ReentrantLock();
	@Override
	public int next() {
		lock.lock();
		try {
			++currentEvenValue;
			Thread.yield();
			++currentEvenValue;
			
			return currentEvenValue;
		}finally{
			lock.unlock();
		}
		
	}
	
	public static void main(String[] args) {
		TIJ674_EvenChecker.test(new TIJ674_EvenGenerator());
	}
}
